package com.hm.prac2;

public class ComparableCircle extends Circle implements Comparable{
    public ComparableCircle(double radius) {
        super(radius);
    }

    @Override
    public int compareTo(Object o) {
        if(o instanceof Circle temp){
            return Double.compare(this.getRadius(),temp.getRadius());
        }else{
            try {
                throw new Exception("比较类型错误");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
